#include "practice_15.10.h"

int main(void) {
    int fd, i, n, len;  
    char line[MAXLINE];

    if ((fd= open(FIFO_NAME, O_WRONLY)) < 0)
        err_sys("open error");

    n= 10;
    for (i=0; i<n; i++) {
        snprintf(line, MAXLINE, "send data chunk %d to fifo from client(pid %d)", i, getpid());
        len= strlen(line);
        if (write(fd, line, len) != len) {
            err_sys("write error");
        }
        sleep(1);
    }

    return 0;
}
